package io;

import java.io.*;

public class PrintWriterDemo02 {
    public static void main(String[] args) throws FileNotFoundException {
        //1.构建打印流对象(思考装饰模式)
        PrintWriter printWriter = new PrintWriter(
                new BufferedWriter(
                        new OutputStreamWriter(
                                new FileOutputStream("./pw.txt"))), true);
        //2.写数据
        printWriter.println("hello");
        printWriter.println("Java");
        //3.关闭流对象
        printWriter.close();
    }
}
